import { ApiProperty } from '@nestjs/swagger';
import { IsHash, IsNotEmpty, IsString, MaxLength, MinLength } from 'class-validator';
import { GeetestValidateReqDto } from '../../../../geetest/dtos/geetest.validate.req.dto';

export class LoginValidateAdminReqDto extends GeetestValidateReqDto {
  @ApiProperty({ description: '用户唯一标识：用户名/手机号/邮箱' })
  @MaxLength(50, { message: '用户名不能超过50位' })
  @MinLength(2, { message: '用户名最低为2位' })
  @IsNotEmpty({ message: '用户名不能为空' })
  @IsString({ message: '用户名应为字符串类型' })
  readonly identifier: string;

  @ApiProperty({ description: '密码（MD5加密）' })
  @IsHash('md5', { message: '加密方式错误' })
  @IsNotEmpty({ message: '密码不能为空' })
  @IsString({ message: '密码应为字符串类型' })
  readonly password: string;
}
